package rank1400;

/**
 * 2110. 股票平滑下跌阶段的数目
 */
public class No2110 {
    public long getDescentPeriods(int[] prices) {
        long ans = 1;
        int num = 1;
        for (int i = 1; i < prices.length; i++) {
            if (prices[i] == prices[i - 1] - 1) num++;
            else num = 1;
            ans += num;
        }
        return ans;
    }
}
